<?php 
	$items = array();
	
	if($_REQUEST["type"] == "occasions"){
		
		$occasions = "ontbijt,koffie en gebak,lunch,afternoon tea,borrel,diner,verjaardag,high-tea,jubileum";
		
		$arr = explode(",",$occasions);
		sort($arr);
		If ( Isset($_REQUEST['value'])) {
			$value = $_REQUEST['value'];
		} else {
			$value="";
		}
		
		if($value){
			$i = 1;
			foreach($arr as $key=>$val){
				if(strpos($val,$value) !== FALSE){
					$items[] = array("value"=>$i,"label"=>$val);
				}	
				$i++;
			}
		} else {
			$i = 1;
		foreach($arr as $key=>$val){
					$items[] = array("value"=>$i,"label"=>$val);	
				$i++;
			}
		
		}
	}
	elseif($_REQUEST["type"] == "city"){
		$cities = array(
			9940	=>	array(
				"Ertvelde","Evergem","Kluizen","Sleidinge"
			),
			9100	=>	array(
				"Sint-Niklaas","Nieuwkerken-Waas"
			),
			9890	=>	array(
				"Asper","Baaigem","Dikkelvenne","Gavere","Semmerzake","Vurste"
			)
		);
		
		$value = $_REQUEST["value"];
		if(isset($cities[$value])){
			foreach($cities[$value] as $key=>$val){
				$items[] = array("value"=>$key,"label"=>$val);
			}
		}
	}
	
	print json_encode($items);
?>